package com.zrt.pad;

import com.zrt.pad.padpos.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;

public class LoginActivity extends Activity implements OnClickListener, OnEditorActionListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.loginframe);
		findViewById(R.id.btnlogin).setOnClickListener(this);
		findViewById(R.id.btncancel).setOnClickListener(this);
		findViewById(R.id.btnset).setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {	 
			case R.id.btnlogin: {
		        Intent intent = new Intent();
		        intent.setClass(LoginActivity.this, MainActivity.class);
		        LoginActivity.this.startActivity(intent);
		        LoginActivity.this.finish();
			}
			break;
			
	        case R.id.btncancel: {
	        	android.os.Process.killProcess(android.os.Process.myPid());
	        	System.exit(0);
			}
			break;
			
	        case R.id.btnset: {
		        Intent intent = new Intent();
		        intent.setClass(LoginActivity.this, SysSetActivity.class);
		        LoginActivity.this.startActivity(intent);
		        LoginActivity.this.finish();
			}
			break;
			
			default: 
				break;
		}
	}

	@Override
	public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
		// TODO Auto-generated method stub
		if (event!=null&&event.getKeyCode()== KeyEvent.KEYCODE_ENTER) {    
            //do something;
			switch (v.getId()) {
					case R.id.txtpasswd: {
						
					}
					break;
					
				    default: 
				      break;
			}
            return true;  
           }  
		return false;
	}

}
